import { ACCurrentValuePublisher } from './ACPublisher';
import { ACSubject } from './ACSubject';

export class ACCurrentValueSubject<T> extends ACSubject<T> {
  cachedValue: T;
  constructor(initValue: T) {
    super();
    this.cachedValue = initValue;
  }

  addPublisher(): ACCurrentValuePublisher<T> {
    let publisher = new ACCurrentValuePublisher<T>(this.cachedValue);
    this.publisherList.push(publisher);
    return publisher;
  }
}
